<template>
  <div class="left_container">
        <search-bar @query_click="handleQueryClick" @reset_click="handleResetClick" />
        <operation-bar ref="operation_bar" @click_create_item="handleClickCreateItem" />
        <pagination-table ref="pagination_table" @click_edit="handleClickEdit" @click_alter="handleClickAleter"  @click_create_reception="handleReceprion" />
        <!--可选：操作栏组件，表单组件，抽屉组件-->
        <my-form ref="my_form" @submit_success="handleSubmitSuccess" />
        <Trans-feror ref="trans_feror" @submit_success="handleSubmitSuccess" />
  </div>
</template>

<script>
import SearchBar from './search-bar'
import PaginationTable from './pagination-table'
/** 可选：表单组件，操作栏组件，抽屉组件 */
import MyForm from './form'
import TransFeror from './form/transferor.vue'
import OperationBar from './operation-bar'
export default {
  name: 'ItemList',
  /** 可选：表单组件，操作栏组件，抽屉组件 */
  components: {
    SearchBar,
    PaginationTable,
    MyForm,
    OperationBar,
    TransFeror
  },
  data() {
    return {
      activeName:'left',
      isShow:false
    }
  },
  methods: {
    handleClick(tab, event){
      console.log(tab,event);
    },
    /** 搜索栏组件事件处理----------------------------------------------------------- */
    /** 点击查询栏【查询】按钮 */
    handleQueryClick(queryParams) {
      this.$refs['pagination_table'].handleQuery(queryParams)
    },
    /** 点击查询栏【重置】按钮 */
    handleResetClick() {
      this.$refs['pagination_table'].handleQuery(null)
    },
    /** 操作栏组件的事件处理 -----------------------------------------------------------*/
    /** 点击操作栏【添加...】按钮 */
    handleClickCreateItem() {
      this.$refs['my_form'].openDialog(null)
    },
    // 表单组件事件处理
    /** 表单提交成功 */
    handleSubmitSuccess() {
      this.$refs['pagination_table'].refreshList()
    },
    /** 页码表格组件事件处理 -----------------------------------------------------------*/
    /** 点击列表【编辑】按钮 */
    handleClickEdit(id) {
      this.$refs['my_form'].openDialog(id)
    },
    /** 点击列表【转维修单】按钮 */
    handleClickAleter(id) {
      this.$refs['trans_feror'].openDialog(id)
    },
    // 传递基值id给父级tab标签
    handleReceprion(id){
      this.$emit('click_create_receptiondate',id)
    }
  }
}
</script>
<style lang="scss" scoped>
.left_container{
  padding: 0;
}
</style>
